package Common 
{
	import flash.xml.XMLNode;
	/**
	 * ...
	 * @author Serg de Adelantado
	 */
	public class XMLUtils 
	{		
		public function XMLUtils() 
		{			
		}
		
		static public function Node(AParent:XMLNode, AName:String):XMLNode
		{
			var vResult:XMLNode = null;
			var vNodes:Array = AParent.childNodes;
			for each(var vNode:XMLNode in vNodes)
			{
				if (vNode.nodeName == AName)
				{
					vResult = vNode;
					break;
				}
			}
			return vResult;
		}
		
		static public function NodesByName(AParent:XMLNode, AName:String):Vector.<XMLNode>
		{
			var vResult:Vector.<XMLNode> = new Vector.<XMLNode>;
			var vNodes:Array = AParent.childNodes;
			for each(var vNode:XMLNode in vNodes)			
				if (vNode.nodeName == AName)				
					vResult.push(vNode);			
			return vResult;
		}
		
		static public function IntAttribute(ANode:XMLNode, AName:String):int
		{
			return int(ANode.attributes[AName]);
		}
	}
}